package pl.balon.gwt.diagrams.client.connection.pointwidget;

import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;

public class PositionUpdateMouseOutHandler implements MouseOutHandler {

	public void onMouseOut(MouseOutEvent event)  {
		MoveablePointWidgetImpl widget = (MoveablePointWidgetImpl) event.getSource();
//		Widget parent = widget.getParent();
//		int newLeft = widget.getAbsoluteLeft()-parent.getAbsoluteLeft()+widget.getOffsetWidth()/2;
//		int newTop = widget.getAbsoluteTop()-parent.getAbsoluteTop()+widget.getOffsetHeight()/2;;
//		GWT.log("PositionUpdateMouseOutHandler - Index:" + widget.getControledIndexPoint() + "New Point left:"+ newLeft +" top: " + newTop, null);
		if(widget.hasMoved()) {
			widget.getConnection().fireEvent(new MoveablePointWidgetMoveEvent(widget));
		}

	}

}
